<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:p="http://primefaces.org/ui"
                xmlns:h="http://java.sun.com/jsf/html">

    <h:form id="view-tree-form">

        <p:contextMenu for="tree-comp-id">
            <p:menuitem value="Adauga" icon="ui-icon-plus" oncomplete="treeNodeDialog.show()" update=":add-node-form" actionListener="#{treeAdministrationBean.setupTreeNodeDialog('add')}"/>
            <p:menuitem value="Editeaza" icon="ui-icon-pencil" oncomplete="treeNodeDialog.show()" update=":add-node-form" actionListener="#{treeAdministrationBean.setupTreeNodeDialog('edit')}"/>
        </p:contextMenu>

        <p:tree id="tree-comp-id" var="node" dynamic="true" value="#{treeAdministrationBean.rootModel}"
                selection="#{treeAdministrationBean.selectedTreeNode}"
                selectionMode="single" rendered="#{treeAdministrationBean.treeLoaded}" draggable="#{treeAdministrationBean.moveActivated}" droppable="true"
                dragdropScope="demo" dropRestrict="sibling" style="border: none;width :480px;">

            <p:ajax event="select" process="@this" listener="#{treeAdministrationBean.updateSelection}"/>
            <p:ajax event="dragdrop" process="@this" listener="#{treeAdministrationBean.onDragDrop}"/>

            <p:treeNode icon="#{node.tpeIco}">
                <h:panelGroup>
                    <h:outputText id="treeNodeNme" value="#{node.name}" styleClass="#{node.styleClass}"/>
                    <p:graphicImage id="err" url="/image/exclamation.png" rendered="#{node.error}"/>
                    <br/>
                    <p:tooltip for="treeNodeNme">
                        <h:outputText value="Denumirea: #{node.description}"/><br/>
                        <h:outputText value="Telefon 1: #{node.tel1}"/><br/>
                        <h:outputText value="Telefon 2: #{node.tel2}"/><br/>
                        <h:outputText value="Telefon 3: #{node.tel3}"/>
                    </p:tooltip>
                    <p:tooltip for="err">
                        <h:outputText value="Au fost gasite mai multe persoane pentru o functie !"/>
                    </p:tooltip>
                    <h:outputText value="#{node.firstName} #{node.lastName}" styleClass="#{node.folderStyleClass}"/>
                </h:panelGroup>
            </p:treeNode>
        </p:tree>

    </h:form>

    <!--<ui:include src="tree-node-dialog.xhtml" />-->

</ui:composition>